package com.xinqing.test.LetCode;

/**
 * @Author:CHQ
 * @Date:2021/7/21 10:48
 * @Description
 */
public class LastRemaining {
    public static void main(String args[]){

    System.out.print(test(5,3));
    }
    public static int test(int n,int m){

        int res=0;

        for(int i=2;i<=n;i++){
            res=(res+m)%i;
        }
        return res;
    }
}
